<template>
    <div class="app-container">
        <elTable ref="t" :formData="formData" @tableData="getList">
            <el-table-column v-for="item in tableField"
                 :prop="item.prop"
                 :label="item.label"
                 align="center"
                 :show-overflow-tooltip="true"
                 :formatter="item.formatter"
            >
            </el-table-column>
        </elTable>
    </div>
</template>

<script>
    import apisAccount from '@/api/accounts/accountLibrary' //api
    import elTable from "@/components/xForm/elTable" //表格组件
    export default {
        name: "viewRedPacket",
        data() {
            return {
                formData: {
                    id: '',
                    currentPage: 1,
                    pageSize: 10
                },
                tableField: [
                    {label: '名称', prop: 'name'},
                    {label: '券码', prop: 'money'},
                    {label: '面值', prop: 'fromwhere'},
                    {label: '来源', prop: 'fromwhere'},
                    {label: '领取时间', prop: 'time', formatter:(row, column, cellValue, index)=>{
                            return row.time
                        }},
                    {label: '使用时间', prop: 'time', formatter:(row, column, cellValue, index)=>{
                            return row.time
                        }},
                    {label: '发放人', prop: 'fromwhere'},
                    {label: '有效期', prop: 'status', formatter:(row, column, cellValue, index)=>{
                            return row.status
                        }},
                    {label: '是否启用', prop: 'status', formatter:(row, column, cellValue, index)=>{
                            return row.status
                        }},
                ]
            }
        },
        components: { elTable },
        methods: {
            getList(pageNo) {
                let that = this
                this.formData.currentPage = pageNo || this.formData.currentPage
                let dataInfo = [{
                    id: 1,
                    name: '红包1',
                    money: 20,
                    time: '2020-10-2',
                    status: '已使用',
                }]
                let total = 13
                this.$nextTick(()=>{
                    this.$refs.t.loadData(dataInfo, total)
                })
            }
        }
    }
</script>

<style scoped>

</style>
